#include <stdio.h>
#include <stdlib.h>

struct list{
	struct list* pre;
	int number;
};

int cc=0;

void printList(struct list *l){
	printf("%d\t",l->number);
	struct list* pre=l->pre;
	while(pre!=NULL){
		printf("%d\t",pre->number);
		pre=pre->pre;
		if(cc++>20)
			return;
	}
}
int main(){
	struct list l1;
	l1.number=5;
	l1.pre=NULL;
	printf("rand %d\n",rand());
	
	struct list * last=&l1;
	struct list * n;
	int i=0;
	for(i=0;i<10;i++){
		n=(struct list*)malloc(sizeof(struct list));
		n->number=i;
		n->pre=last;
		last=n;
	}
	
	printList(last);
}